package com.zm.testbean;

import com.zm.services.IAcountServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;

import javax.annotation.Resource;
import java.util.Date;


@Scope("prototype")
public class Diclass {
    @Value("String222")
    private String userName;
    @Value("1234")
    private Integer userId;
    private Date userBirthday;
    //@Autowired
    //@Qualifier("AccountServicesImpl")
    @Resource(name="AccountServicesImpl2")
    private IAcountServices acountServices;


    public Diclass(String userName, Integer userId, Date userBirthday) {
        this.userName = userName;
        this.userId = userId;
        this.userBirthday = userBirthday;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Date getUserBirthday() {
        return userBirthday;
    }

    public void setUserBirthday(Date userBirthday) {
        this.userBirthday = userBirthday;
    }

    public IAcountServices getAcountServices() {
        return acountServices;
    }

    public void setAcountServices(IAcountServices acountServices) {
        this.acountServices = acountServices;
    }
    public void accountSaveMethod(){
        System.out.println("自动类型注入的对象所调用的方法");
        //acountServices.saveAccount();
    }

    @Override
    public String toString() {
        return "Diclass{" +
                "userName='" + userName + '\'' +
                ", userId=" + userId +
                ", userBirthday=" + userBirthday +
                ", acountServices=" + acountServices +
                '}';
    }
}
